<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button>跳转副页面</button>
    <script>
        // 获取元素跳转
        document.querySelector('button').onclick = function(){
            window.location.href = `副页面.html?${o2s(obj)}`
        }

        let obj = {
            name : "张三",
            age : 18 ,
            hobby : "打篮球"
        }
        // 转换函数

        let o2s = obj => Object.keys(obj).map((key,index) => `${key} = ${Object.values(obj)[index]}`).join('&')
        // function oTs(obj){
        //     var keys = Object.keys(obj);
        //     var values = Object.values(obj);
        //     console.log(keys,values);
        //     var arr = keys.map((item,index) => `${item}=${values[index]}`);
        //     return arr.join('&');
        // };
    </script>
</body>
</html>